<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                template="./template.xhtml">

    <ui:define name="title">
        DataTable - <span class="subitem">Header and Footer</span>
    </ui:define>

    <ui:define name="description">
        Header and Footer section are defined using facets.
    </ui:define>

    <ui:param name="documentationLink" value="/components/datatable" />

    <ui:define name="implementation">
        <p:dataTable var="car" value="#{dtBasicView.cars}">
            <f:facet name="header">
                List of Cars
            </f:facet>
            
            <p:column headerText="Id">
                <h:outputText value="#{car.id}" />
            </p:column>

            <p:column headerText="Year">
                <h:outputText value="#{car.year}" />
            </p:column>

            <p:column headerText="Brand">
                <h:outputText value="#{car.brand}" />
            </p:column>

            <p:column headerText="Color">
                <h:outputText value="#{car.color}" />
            </p:column>
            
            <f:facet name="footer">
                In total there are #{fn:length(dtBasicView.cars)} cars.
            </f:facet>
        </p:dataTable>
    </ui:define>

</ui:composition>